package com.csc.banking.dao;

import javax.persistence.TypedQuery;

import org.springframework.stereotype.Component;

import com.csc.banking.model.TransactionAction;
import com.csc.banking.model.TransactionType;

@Component
public class TransactionTypeDao extends GenaricDao 
{
	@Override
	Class<?> getEntityClass() 
	{
		return TransactionAction.class;
	}

	public TransactionType getTransactionType(String typeName) 
	{
		TypedQuery<TransactionType> query = em.createQuery(
	            "SELECT g FROM TransactionType g where g.transactionType=:typeName", TransactionType.class).setParameter("typeName", typeName);
	    	try
	    	{
	    		return query.getSingleResult();
	    	}
	    	catch(Exception e)
	    	{
	    	}
	    	return null;
	}
}